from ..models.base_model import BaseModel
from ..models.student import Student
from ..models.classinfo import ClassInfo
from django.contrib.auth.models import User
from django.db import models
from django.utils.timezone import localdate

# 学生表现记录
class DailyAttendance(BaseModel):
    """每日考勤记录"""
    student = models.ForeignKey(Student, on_delete=models.CASCADE, related_name='daily_attendances', verbose_name="学生")
    date = models.DateField(default=localdate, verbose_name="日期")
    morning_attendance=models.BooleanField(default=False,verbose_name="上午考勤")
    afternoon_attendance=models.BooleanField(default=False,verbose_name="下午考勤")
    evening_attendance=models.BooleanField(default=False,verbose_name="晚自习考勤")

    cleaning_task_completed = models.BooleanField(default=False, verbose_name="清洁任务完成")
    

    def __str__(self):
        return f"{self.student} - {self.date}"

    class Meta:
        verbose_name = "每日考勤"
        verbose_name_plural = "每日考勤"
        unique_together = ('student', 'date')
    
    
